import { request } from "@/utils/http";
import type { getHosSetListParamsType, getHosSetListReturn, addHospitalParamsType, getHosSetListItemType, updateHosSetFromIdParamType } from "./model/hospitalSetType";
import {Key} from "react";
//获取医院分页列表
export const getHosSetListRequest = ({ page, limit, hosname, hoscode }: getHosSetListParamsType) => {
    return request.get<any, getHosSetListReturn>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
        params: {
            hosname,
            hoscode
        }
    })
}
//添加医院请求
export const addHospitalRequest = (data: addHospitalParamsType) => {
    return request.post<any, null>("/admin/hosp/hospitalSet/save", data)
}
//获取医院数据根据id
export const getHosSetFromIdRequest = (id: string) => {
    return request.get<any, getHosSetListItemType>(`/admin/hosp/hospitalSet/get/${id}`)
}
//修改医院请求
export const updateHosSetFromIdRequest = (data:updateHosSetFromIdParamType) => {
    return request.put<any,null>('/admin/hosp/hospitalSet/update', data)
}

//删除单个医院
export const deleteHosSetFromIdRequest = (id:number) => {
    return request.delete<any,null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

//批量删除医院
export const batchDeleteHosSetRequest = (ids:Key[]) => {
    return request.delete<any,null>('/admin/hosp/hospitalSet/batchRemove',{
        data:ids
    })
}